/*
 *  Librarie de tipuri de date abstracte (TDA)
 
    Copyright (C) 2007  Catedra de Structuri de Date

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License along
    with this program; if not, write to the Free Software Foundation, Inc.,
    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
/**
 @file testutil.h 
 @author Florin Pop
 @brief Simple macro (similar to assert). For a simple CHECK an error counter is 
 incrementeed and the application does not die. (For a CHECK_FATAL it dies...)
*/

#ifndef TESTUTIL_H_
#define TESTUTIL_H_


#define CHECK(err, cond) \
do { \
  if ( !(cond) ) { \
    fprintf(stderr, "[%s : %d] ERROR: %s\n", __FILE__, __LINE__, #cond); \
    err ++; \
  } \
} while(0);


#define CHECK_FATAL(cond) \
do { \
  if ( !(cond) ) { \
  	fprintf(stderr, "[%s : %d] FATAL ERROR: %s\n", __FILE__, __LINE__, #cond); \
    return -1; \
  } \
} while(0);

#endif /*TESTUTIL_H_*/
